package cn.jiyun.controller.request;

import cn.jiyun.common.config.Result;
import cn.jiyun.entity.ChatMessage;
import cn.jiyun.entity.XmNotification;
import cn.jiyun.service.PushService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
/**
 * @className: PushMessageContoller
 * @description: 测试消息推送
 * @author: xuteng
 * @date: 2023/12/30 23:25:11
 * @version: v1.0
 */
@RestController
@RequestMapping("/push")
@CrossOrigin
public class PushMessageController {
    @Resource
    private PushService pushService;
    @GetMapping("/message")
    public Result pushMessage(ChatMessage chatMessage) {
//        XmNotification notification = messageOpenFeign.findById2(id);
//        pushService.pushUser(JSON.toJSONString(notification), "1");
        pushService.pushUser(chatMessage.getContent(), chatMessage.getUserId());
//        pushService.pushUser("小程序发送成功！", "1");
        System.out.println("发送成功");
        return Result.ok("发送成功！");
    }
}
